import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '城市编码',
    align:"center",
    dataIndex: 'code'
   },
   {
    title: '上级编码',
    align:"center",
    dataIndex: 'pcode'
   },
   {
    title: '上级城市名称',
    align:"center",
    dataIndex: 'pcity'
   },
   {
    title: '层级',
    align:"center",
    dataIndex: 'level'
   },
   {
    title: '城市名称',
    align:"center",
    dataIndex: 'city'
   },
   {
    title: '拼音',
    align:"center",
    dataIndex: 'py'
   },
   {
    title: '城市拼音首字母',
    align:"center",
    dataIndex: 'indexLetter'
   },
   {
    title: '是否热门',
    align:"center",
    dataIndex: 'isHot_dictText'
   },
   {
    title: '纬度',
    align:"center",
    dataIndex: 'latitude'
   },
   {
    title: '经度',
    align:"center",
    dataIndex: 'longitude'
   },
   {
    title: '排序',
    align:"center",
    dataIndex: 'sort'
   },
   {
    title: '启用状态',
    align:"center",
    dataIndex: 'status_dictText'
   },
   {
    title: '创建时间',
    align:"center",
    dataIndex: 'createTime',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text)
    },
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
	{
      label: "城市编码",
      field: 'code',
      component: 'Input',
      colProps: {span: 6},
 	},
	{
      label: "城市名称",
      field: 'city',
      component: 'Input',
      colProps: {span: 6},
 	},
	{
      label: "是否热门",
      field: 'isHot',
      component: 'JDictSelectTag',
      componentProps:{
          dictCode:"is_hot"
      },
      colProps: {span: 6},
 	},
	{
      label: "启用状态",
      field: 'status',
      component: 'JDictSelectTag',
      componentProps:{
          dictCode:"status"
      },
      colProps: {span: 6},
 	},
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '城市编码',
    field: 'code',
    component: 'Input',
  },
  {
    label: '上级编码',
    field: 'pcode',
    component: 'Input',
  },
  {
    label: '上级城市名称',
    field: 'pcity',
    component: 'Input',
  },
  {
    label: '层级',
    field: 'level',
    component: 'InputNumber',
  },
  {
    label: '城市名称',
    field: 'city',
    component: 'Input',
  },
  {
    label: '拼音',
    field: 'py',
    component: 'Input',
  },
  {
    label: '城市拼音首字母',
    field: 'indexLetter',
    component: 'Input',
  },
  {
    label: '是否热门',
    field: 'isHot',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"is_hot"
     },
  },
  {
    label: '纬度',
    field: 'latitude',
    component: 'Input',
  },
  {
    label: '经度',
    field: 'longitude',
    component: 'Input',
  },
  {
    label: '排序',
    field: 'sort',
    component: 'InputNumber',
  },
  {
    label: '启用状态',
    field: 'status',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"status"
     },
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];



/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}